'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Cate extends Model {
    // 获取分类列表数据
    async getCateList(){
        return await Cate.findAll()
    }
    static associate(models) {
       models.Cate.hasMany(models.New)
    }
  }
  Cate.init({
    cate_name: DataTypes.STRING,
    sort: DataTypes.INTEGER
  }, {
    sequelize,
    modelName: 'Cate',
  });
  return Cate;
};